<template>
  <el-row class="header-style">
    <span class="header_font" style="margin: 10px;">CRM&MBS Tools</span>

<!--    <el-menu  class="el-menu-demo" mode="horizontal" @select="handleSelect">-->
<!--          <el-menu-item index="1">处理中心</el-menu-item>-->
<!--    </el-menu>-->

    <div style="float: right">

      <span class="header_font" style="margin: 10px;">
<!--        <el-link type="primary" href="/#/CreateAutoTaskPage" target="_blank" >研发自测平台</el-link>-->
      </span>

      <span class="header_font" style="margin: 10px;">
        <el-link type="primary" href="/#/TaskListView" target="_blank" >旧发布工具</el-link>
      </span>

      <span class="header_font" style="margin: 10px;">
        <el-link type="primary" href="http://processx.test.sz.shopee.io/#/release/list" target="_blank" >新发布工具</el-link>
      </span>

      <span class="header_font" style="margin: 10px;">
        <el-link type="primary" href="https://confluence.shopee.io/pages/viewpage.action?pageId=629310280" target="_blank" >帮助文档</el-link>
      </span>



      <div class="menu">
        <i class="el-icon-user-solid" style="color:#409EFF"></i>
        <el-dropdown @command="handleCommand">
        <span class="el-dropdown-link">
            {{googleEmail}}<i class="el-icon-arrow-down el-icon--right"></i>
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item command="google_logout">退出登录</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
    </div>

  </el-row>
</template>

<script>
    import {api, postRequest} from "@/api/commit";

    export default {
        props:[
            "googleEmail"
        ],
        data() {
            return {

            }
        },
        created() {

        },
        methods: {
            handleCommand(command) {
                if (command == 'google_logout') {
                    let url = api['google_logout']
                    postRequest(url, null).then((res) => {
                        this.$router.push({
                            path: '/'
                        })
                    }, (err) => {
                      window.location.href = window.location.origin+"/"+api['google_login']+"?next="+window.location.origin;
                    })
                }
            }
        }
    }
</script>

<style scoped>
  .header-style {
    background-color: #545c64;
  }

  .header_font {
    color: rgb(162, 162, 162);
  }

  .el-dropdown-link {
    cursor: pointer;
    color: #409EFF;
  }

  .el-icon-arrow-down {
    font-size: 12px;
  }

  .menu {
    display: inline-block;
    font-size: 14px;
    margin-right: 20px;
  }
  a:link    {color:rgb(162, 162, 162);;}
  a:visited {color:rgb(162, 162, 162);;}
  a:hover   {color:rgb(162, 162, 162);;}
  a:active  {color:rgb(162, 162, 162);;}
</style>

